﻿using System;
using System.Collections.Generic;

using System.Text;
using EnvDTE;

namespace DoxygenBrowserAddin.Controller
{
    public class CmdShowDoxBrowser : AddInCommand
    {
        public CmdShowDoxBrowser(string strShortName, DoxAddinController controller)
            : base(strShortName, controller)
        {
            _strButtonText = "Doxygen Browser";
            _strToolTipText = "Executes the command for DoxygenAddin";
            _iIconID = 59;
        }

        public override bool Execute(EnvDTE.vsCommandExecOption executeOption, ref object varIn, ref object varOut)
        {

            _controller.OnShowDoxBrowser();

            return true;
        }
        public override void QueryStatus(EnvDTE.vsCommandStatusTextWanted neededText, ref EnvDTE.vsCommandStatus status, ref object commandText)
        {
            base.QueryStatus(neededText, ref status, ref commandText);

            Solution solution = _controller.Application.Solution;
            status = (vsCommandStatus)(status & ~vsCommandStatus.vsCommandStatusEnabled);
            if ((solution != null) && (solution.IsOpen) && (_controller.DoxygenConfig != null))
            {
                status = (vsCommandStatus)(status | vsCommandStatus.vsCommandStatusEnabled);
            }
        }
    }
}
